﻿using System;
using UnityEngine;
using UnityEngine.UI;

public class ButtonDisablePlugin : MonoBehaviour
{
    private Button m_Button;
    private GrayImage []m_Image;
    private void Start()
    {
        m_Button = GetComponent<Button>();
        m_Image = GetComponentsInChildren<GrayImage>();
    }

    private void Update()
    {
        if (m_Button && m_Image != null)
        {
            foreach(var i in m_Image)
            {
                if (m_Button.interactable)
                {
                    i.color = Color.white;
                }
                else
                {
                    i.color = Color.black;
                }
            }
        }
    }
}